﻿using System;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.Tree;

namespace Sapphire.RSharp
{
  class TroubleAnalyzerProcessor : IRecursiveElementProcessor
  {
    private readonly Action<IElement> _afterAction;

    public TroubleAnalyzerProcessor(Action<IElement> action)
    {
      _afterAction = action;
    }

    public bool InteriorShouldBeProcessed(IElement element)
    {
      return true;
    }

    public void ProcessBeforeInterior(IElement element)
    {
    }

    public void ProcessAfterInterior(IElement element)
    {
      _afterAction(element);
    }

    public bool ProcessingIsFinished
    {
      get { return false; }
    }
  }
}